﻿using System;
using System.Globalization;
using Medianamik.Core;
using Medianamik.Core.DAL;
using Medianamik.Core.DAL.Repositories;
using Medianamik.Core.DAL.Services;
using SubSonic;

namespace Medianamik.UI.Web.Shop.Data.Repositories
{
    public class RegionRepository<TCollection, TItem> : 
        MedianamikRepository<TCollection, TItem>, IRegionRepository<TItem> 
        where TItem : Interfaces.IRegion, IRecordBase, new() 
        where TCollection : ICollectionWithChildren<TCollection, TItem>, new()
    {
        public RegionRepository(ICultureService cultureService, IContentStateService contentStateService, INodeMapper nodeMapper) : base(cultureService, contentStateService, nodeMapper)
        {
        }
    }

    public class RegionRepository : RegionRepository<RegionCollection, Region>, IRegionRepository
    {
        public RegionRepository(ICultureService cultureService, IContentStateService contentStateService, INodeMapper nodeMapper)
            : base(cultureService, contentStateService, nodeMapper)
        {
        }

        public override Region Get(Guid nodeId)
        {
            return Get(nodeId, CultureInfo.CurrentUICulture, ContentState.Draft);
        }
    }

    public interface IRegionRepository<T> : IMedianamikRepository<T>
        where T : Interfaces.IRegion
    {
    }

    public interface IRegionRepository: IRegionRepository<Region>
    {
    }
}
